home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
dev
/
gcc
/
ixemul_src.lha
/
ixemul-41.0
/
man
/
cat2
/
truncate.0
< prev
next >
Wrap
Text File
|
1992-08-10
|
3KB
|
133 lines
TRUNCATE(2) UNIX Programmer's Manual TRUNCATE(2)
NNAAMMEE
ttrruunnccaattee - truncate a file to a specified length
SSYYNNOOPPSSIISS
##iinncclluuddee <<uunniissttdd..hh>>
_i_n_t
ttrruunnccaattee(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _o_f_f___t _l_e_n_g_t_h)
_i_n_t
ffttrruunnccaattee(_i_n_t _f_d, _o_f_f___t _l_e_n_g_t_h)
DDEESSCCRRIIPPTTIIOONN
TTrruunnccaattee() causes the file named by _p_a_t_h or referenced by _f_d to be trun
cated to at most _l_e_n_g_t_h bytes in size. If the file previously was larger
than this size, the extra data is lost. With ffttrruunnccaattee(), the file must
be open for writing.
RREETTUURRNN VVAALLUUEESS
A value of 0 is returned if the call succeeds. If the call fails a 1 is
returned, and the global variable _e_r_r_n_o specifies the error.
EERRRROORRSS
TTrruunnccaattee() succeeds unless:
[ENOTDIR] A component of the path prefix is not a directory.
[EINVAL] The pathname contains a character with the highorder bit set.
[ENAMETOOLONG]
A component of a pathname exceeded 255 characters, or an en
tire path name exceeded 1023 characters.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path pre
fix.
[EACCES] The named file is not writable by the user.
[ELOOP] Too many symbolic links were encountered in translating the
pathname.
[EISDIR] The named file is a directory.
[EROFS] The named file resides on a readonly file system.
[ETXTBSY] The file is a pure procedure (shared text) file that is being
executed.
[EIO] An I/O error occurred updating the inode.
[EFAULT] _P_a_t_h points outside the process's allocated address space.
FFttrruunnccaattee() succeeds unless:
[EBADF] The _f_d is not a valid descriptor.
[EINVAL] The _f_d references a socket, not a file.
[EINVAL] The _f_d is not open for writing.
SSEEEE AALLSSOO
open(2)
BBUUGGSS
These calls should be generalized to allow ranges of bytes in a file to
be discarded.
HHIISSTTOORRYY
The ttrruunnccaattee function call appeared in 4.2BSD.
4.2 Berkeley Distribution March 10, 1991 2